package com.hmy.pig.service.impl;

import com.hmy.pig.domain.HmyPig;
import com.hmy.pig.domain.HmyPigBreed;
import com.hmy.pig.domain.HmyPigLive;
import com.hmy.pig.mapper.PigBreedMapper;
import com.hmy.pig.mapper.PigLiveMapper;
import com.hmy.pig.service.PigBreedService;
import com.hmy.pig.service.PigLiveService;
import com.hmy.staff.domain.HmyStaff;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zhl
 * @descript 描述 猪只配种 业务层 实现类
 * @date 2024-01-29
 */

@Service
public class PigLiveServiceImpl implements PigLiveService {

    @Resource
    private PigLiveMapper pigLiveMapper;


    @Override
    public List<HmyPigLive> selectPigLiveList(String pigCode,
                                               Integer pigLiveType,
                                               String pigLiveManager,
                                               String pigLiveDatetimeStart,
                                               String pigLiveDatetimeEnd) {
        return pigLiveMapper.selectPigLiveList(pigCode,pigLiveType,pigLiveManager,pigLiveDatetimeStart,pigLiveDatetimeEnd);
    }

    @Override
    public int insertPigLive(HmyPigLive hmyPigLive) {
        //新增猪只信息
        int rows =  pigLiveMapper.insertPigLive(hmyPigLive);
        return rows;

    }


    /**
     * @param pigLiveId
     * @return com.hmy.pig.domain.HmyPigLive
     * @author ZHL
     * @date 2024/1/31 15:31
     * @description   根据pigLiveId查询猪只分娩记录信息
     */
    @Override
    public HmyPigLive selectPigLiveByPigLiveId(Long pigLiveId) {
        return pigLiveMapper.selectPigLiveByPigLiveId(pigLiveId);
    }
    /**
     * @param hmyPigLive
     * @return int
     * @author ZHL
     * @date 2024/1/31 15:31
     * @description  修改母猪分娩记录
     */
    @Override
    public int updatePigLive(HmyPigLive hmyPigLive) {
        return pigLiveMapper.updatePigLive(hmyPigLive);
    }
    /**
     * @param pigLiveId
     * @return int
     * @author ZHL
     * @date 2024/1/31 15:32
     * @description  删除母猪分娩记录
     */
    @Override
    public int deletePigLiveByPigLiveId(Long pigLiveId) {
        return pigLiveMapper.deletePigLiveByPigLiveId(pigLiveId);
    }
    /**
     * @param pigLiveIds
     * @return int
     * @author ZHL
     * @date 2024/1/31 15:32
     * @description  根据 pigLiveids 批量删除 母猪分娩记录
     */
    @Override
    public int deletePigLiveByPigLiveIds(Long[] pigLiveIds) {
        return pigLiveMapper.deletePigLiveByPigLiveIds(pigLiveIds);
    }

    @Override
    public List<HmyStaff> findAllStaffName() {
        return pigLiveMapper.findAllStaffName();
    }
}
